﻿<?php
//客户管理类
class CourseAction extends CommonAction {
	public function expand() {
        parent::userauth2(110);
		$data['start'] = empty($_GET['page'])?0:($_GET['page']-1)*15;
		$data['pageSize'] = 15;
		//$data['courseName'] = '';
		$html = send_post(C('URL').'/eduWeb/expand/querySysExpandList',$data);

		$count = $html['data']['count'];
		$list = $html['data']['expandCourseList'];
//		dump($list);
		import('ORG.Util.Page');				// 导入分页类
		$pagenum = isset ( $_REQUEST ['page'] ) ? $_REQUEST ['page'] : 1;
		$page_row = 15;//每页显示条数
		$p = new Page ($count,$page_row,8);
		$p->isJumpPage = true;
		$p->setConfig('theme','%totalRow% %header% %nowPage%/%totalPage% 页%first% %upPage% %linkPage% %downPage% %end% %jump%');
		$show = $p->show();
		$this->assign('list',$list);
		$this->assign('key',$keyWord);
		$this->assign('page',$show);
		$this->assign('newsurl',C('NEWSURL'));
		$this->assign('url',C('URL'));
		$this->assign('admin',$_SESSION['ThinkUser']);
		$this->display();
	}

	public function articles() {
        parent::userauth2(111);
		$data['start'] = empty($_GET['page'])?0:($_GET['page']-1)*15;
		$data['pageSize'] = 15;
		//$data['courseName'] = '';
		$html = send_post(C('URL').'/eduWeb/boutique/querySysBoutiqueList',$data);
		//dump($html);
		$count = $html['data']['count'];
		$list = $html['data']['boutiqueCourseList'];
		//dump($list);
		import('ORG.Util.Page');				// 导入分页类
		$pagenum = isset ( $_REQUEST ['page'] ) ? $_REQUEST ['page'] : 1;
		$page_row = 15;//每页显示条数
		$p = new Page ($count,$page_row,8);
		$p->isJumpPage = true;
		$p->setConfig('theme','%totalRow% %header% %nowPage%/%totalPage% 页%first% %upPage% %linkPage% %downPage% %end% %jump%');
		$show = $p->show();
		$this->assign('list',$list);
		$this->assign('key',$keyWord);
		$this->assign('page',$show);
		$this->assign('newsurl',C('NEWSURL'));
		$this->assign('url',C('URL'));
		$this->assign('admin',$_SESSION['ThinkUser']);
		$this->display();
	}

	//用户详情信息
	public function expandinfo(){
		$data['sid']= $_GET['sid'];
		$html = send_post(C('URL').'/eduWeb/expand/sysexpandCourseDetail',$data);
		//dump($html);
		$this->assign('picList',$html['data']['picList']);
		$this->assign('user',$html['data']['expandCourse']);
		$this->assign('teacher',$html['data']['teacher']);
		$this->assign('url',C('URL'));
		$this->display();
	}

	public function articlesinfo(){
		$data['sid']= $_GET['sid'];
		$html = send_post(C('URL').'/eduWeb/boutique/sysboutiqueCourseDetail',$data);
		$this->assign('picList',$html['data']['picList']);
		$this->assign('user',$html['data']['boutique']);
		$this->assign('url',C('URL'));
		$this->display();
	}

	public function getsearchparam()
	{
		//获取用户状态
		$this->assign('status', D('status')->field('id, name, value')->order('id asc')->where('pid = 1')->select());
	}


	//时间美化函数
	protected function Beautifytime($dtime) {
		$dtime = strtotime($dtime);
		$betime = time()-$dtime;
		$timename='';
		switch($betime) {
			case ($betime < 60):
				$timename = floor($betime).'秒前';
				break;
			case ($betime < 3600 && $betime > 60):
				$timename = floor(($betime/60)).'分钟前';
				break;
			case ($betime < 86400 && $betime > 3600):
				$timename = floor(($betime/60/60)).'小时前';
				break;
			case ($betime < 2592000 && $betime > 86400):
				$timename = floor(($betime/60/60/30)).'天前';
				break;
			case ($betime < 31536000 && $betime > 2592000):
				$timename = floor(($betime/60/60/30/12)).'个月前';
				break;
			case ($betime < 3153600000 && $betime > 31536000):
				$timename = floor(($betime/60/60/30/12/100)).'年前';
				break;
		}
		return $timename;
	}

}
?>

